package com.wootion.cims.module.map.controller;
import com.alibaba.fastjson.JSONObject;
import com.wootion.cims.module.map.service.MapService;
import com.wootion.cims.response.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 用户管理
 */
@RestController
@RequestMapping("/map")
@Api(value = "统计")
public class MapController {
    
    @Resource
    MapService mapService;

    @RequiresAuthentication
    @PostMapping("/statistics")
    @ApiOperation(value = "统计人数", httpMethod = "POST", notes = "{\"password\":\"123456\",\"role\":\"123456\",\"tel\":\"123456\",\"remark\":\"123456\",\"communitys\":[\"123\",\"465\"],\"username\":\"123456\"}")
    public ResponseResult Statistics(@RequestBody JSONObject jsonObject) {
        return mapService.statistics(jsonObject);
    }

    @RequiresAuthentication
    @PostMapping("/statisticsbytype")
    @ApiOperation(value = "统计婴幼儿", httpMethod = "POST", notes = "")
    public ResponseResult statisticsByType(@RequestBody JSONObject jsonObject) {
        return mapService.statisticsByType(jsonObject);
    }

    @RequiresAuthentication
    @PostMapping("/statisticsmap")
    @ApiOperation(value = "统计表", httpMethod = "POST", notes = "")
    public ResponseResult statisticsMap(@RequestBody JSONObject jsonObject) {
        return mapService.statisticsMap(jsonObject);
    }

    @RequiresAuthentication
    @PostMapping("/statisticsmapcir")
    @ApiOperation(value = "统计饼状图", httpMethod = "POST", notes = "")
    public ResponseResult statisticsMapCircle(@RequestBody JSONObject jsonObject) {
        return mapService.statisticsMapCircle(jsonObject);
    }

    @RequiresAuthentication
    @PostMapping("/statisticsbytypeold")
    @ApiOperation(value = "统计", httpMethod = "POST", notes = "")
    public ResponseResult statisticsByTypeOld(@RequestBody JSONObject jsonObject) {
        return mapService.statisticsByTypeOld(jsonObject);
    }

    @RequiresAuthentication
    @PostMapping("/statisticsmapold")
    @ApiOperation(value = "统计表", httpMethod = "POST", notes = "")
    public ResponseResult statisticsMapOld(@RequestBody JSONObject jsonObject) {
        return mapService.statisticsMapOld(jsonObject);
    }

    @RequiresAuthentication
    @PostMapping("/statisticsmapcirold")
    @ApiOperation(value = "统计饼状图", httpMethod = "POST", notes = "")
    public ResponseResult statisticsMapCircleOld(@RequestBody JSONObject jsonObject) {
        return mapService.statisticsMapCircleOld(jsonObject);
    }

    @RequiresAuthentication
    @PostMapping("/statisticsold")
    @ApiOperation(value = "统计多个饼状图", httpMethod = "POST", notes = "")
    public ResponseResult statisticsOld(@RequestBody JSONObject jsonObject) {
        return mapService.statisticsOld(jsonObject);
    }

}
